package com.baymax.test.scene.url

interface IWrapperUrl {

    sealed class VideoType(val type: String) {
        object VOD : VideoType("ps|program")

        object ORIGIN : VideoType("__ORIGIN__")

        //需要鉴权或者鉴权完毕的
        object EXCHANGE : VideoType("__EXCHANGE__")
    }

    val videoType: VideoType
    val url: String

    abstract class ExchangeUrl(override val videoType: VideoType = VideoType.EXCHANGE) :
        IWrapperUrl

    sealed class WrapperUrl(
        override val videoType: VideoType
    ) : IWrapperUrl {


        data class VodUrl(override val url: String, val pid: String) :
            WrapperUrl(VideoType.VOD) {
            val psId = url
            val valid = psId.isNotBlank()
        }


        internal open class SimpleUrl protected constructor(override val url: String) : WrapperUrl(VideoType.ORIGIN) {

            override fun toString(): String {
                return "SimpleUrl(url='$url',videoType='$videoType')"
            }
        }

        internal data class OriginUrl(override val url: String) : SimpleUrl(url)


        //鉴权前的地址
        data class ExchangeParamUrl(
            val urlFrom: IWrapperUrl,
            override val url: String,
        ) : ExchangeUrl()

        //鉴权后的地址
    }

}
